{include file="public/header"}
<div class="pub_wid notice_cont">
    <div class="notice_left bgb lf" id="newsDetail">
        <h1>最新资讯<span>当前位置：<a href="/">主页</a>><a href="/index/news/index">最新资讯</a>><a href="#">正文</a></span></h1>
        <div class="widthauto">
            <div class="news_head">
                <h1>{{newsDetail.title}}</h1>
                <p><img src="/static/index/public/images/author.png" />作者：{{newsDetail.auto}}<img src="/static/index/public/images/time.png" />发布时间：{{newsDetail.create_time}}<img src="/static/index/public/images/read.png" />{{newsDetail.click}}次</p>
            </div>
            <div class="news_box widthauto" v-html="newsDetail.content">
            </div>
            <ul class="news_foot widthauto">
                <li class="lf"><a  onclick="javascript:window.history.back();"><span>返回</span></a></li>
<!--                <li class="rg"><a href="#"><span>下一篇：</span>即使重来一遍，妈妈依旧做了同样的选择</a></li>-->
            </ul>
        </div>
    </div>

    {include file="public/right"}
</div>
{include file="public/footer"}
<script>
    var id = "{$id}"
    var newsDetailVm = new Vue({
        el:'#newsDetail',
        data:{
            id:id,
            newsDetail:{}
        },
        methods:{
            getDetail:function () {
                var el = this
                var postData = {
                    "id": el.id
                }
                AjaxPost(postData, '/index/news/getDetail').then((response => {
                    if(response.result){
                        el.newsDetail = response.result
                    }
                    console.log(response)
                })).catch(()=>{
                    setTimeout(()=>{
                        window.history.back()
                    },1000)
                })
            }
        },
        mounted(){
            this.$nextTick(function () {
                this.getDetail()
            })
        }
    })
</script>
